//
// Created by jmdvirus on 2019/12/31 下午12:24.
// Copyright (c) 2019 benewtech All rights reserved.
//     
//     ******          *             *--*
//       ||            *             |
//       ||  *--*--*---*  * *-********--*
//   *  //   *  *  *   *\ / ||  |  |    |
//    **    *  *  *---* *  *   *--* *--*
// 

#ifndef OPENGLFUNC_OPENGLQTSIMPLE_H
#define OPENGLFUNC_OPENGLQTSIMPLE_H

#include <QWidget>
#include "OpenGLQtWidget.h"
#include "OpenGLQtEasy.h"
#ifdef WITH_OPENCV

#include "CameraCapture.h"
#endif

class OpenGLQtSimple : public QWidget {
public:
    OpenGLQtSimple(QWidget *parent = NULL);
    int init(int width, int height);

    // set yuv file info
    int setFile(int width, int height, const char *filename);

    void stop() {
        m_stop = true;
    }

protected:
    friend void *qt_simple_thread(void *args);
    int runReadFile();
    int runShowImage();
    int runImageFromCapture();

private:
    OpenGLQtWidget   *m_qtWidget;
    OpenGLQtEasy     *m_qtEasy;
    int          m_yuvWidth;
    int          m_yuvHeight;
    std::string  m_yuvFilename;
    int          m_winWidth;
    int          m_winHeight;
    bool         m_stop;
#ifdef WITH_OPENCV
    CameraCapture    m_capture;
#endif
};


#endif //OPENGLFUNC_OPENGLQTSIMPLE_H
